#include "SUiCtrlPan.h"
#include <QtCore>
#include <QtGui>
#include "SDKDevice/SDevicePluginInterface.h"


//////////////////////////////////////////////////////////////////////////
/// \fn SUiCtrlPan::SUiCtrlPan(QList<SDevicePluginInterface *> lstPugin, QWidget * parrent /* = NULL*/ )
///
/// \brief (SLOT) ctor
///
/////////////////////////////////////////////////////////////////////////
SUiCtrlPan::SUiCtrlPan(QList<SDevicePluginInterface *> lstPugin,
		SGlobalMetaDataMap * GlobalMetaDataMap, QWidget * parent /* = NULL*/ ):
		gmdm_(GlobalMetaDataMap), QMainWindow(parent)
{
	
	this->setGeometry(QRect(0, 0, 635, 390));
	DeviceTab_ = new QTabWidget(this);
	
	DeviceTab_->setObjectName(QString::fromUtf8("DeviceTab_"));
	DeviceTab_->setGeometry(QRect(0, 20, 630, 351));
	DeviceTab_->setTabShape(QTabWidget::Rounded);
	DeviceTab_->setDocumentMode(true);
	DeviceTab_->setMovable(true);

	int t = lstPugin.count();
	for(int i =0; i < t; i++){
		if(lstPugin.at(i)->isControlPanel())
			DeviceTab_->addTab(lstPugin.at(i)->controlPanel(),lstPugin.at(i)->shortName());
	}

	//action of execute the script
	actGlobalMetaDataWindow = new QAction("Global Meta Data",this);
	actGlobalMetaDataWindow->setShortcut(Qt::CTRL +  Qt::Key_M);
	actGlobalMetaDataWindow->setStatusTip(tr("Global Meta Data window"));
	connect(actGlobalMetaDataWindow, SIGNAL(triggered()), this, SLOT(globalMetaDataWindowShow()));

	mnuFile = menuBar()->addMenu(tr("&File"));
	mnuFile->addAction(actGlobalMetaDataWindow);


}


SUiCtrlPan::~SUiCtrlPan(void)
{
}

//////////////////////////////////////////////////////////////////////////
/// \fn void SUiCtrlPan::GlobalMetaDataWindowShow()
///
/// \brief (SLOT) open the visualization window of the global metadata tree.
///
/////////////////////////////////////////////////////////////////////////
void SUiCtrlPan::globalMetaDataWindowShow()
{
	metaDataReader = new SUiMetaDataReader(this);
	metaDataReader->show();



}

